load(
    "//tools:defaults.bzl",
    "extract_tokens",
    "markdown_to_html",
    "ng_project",
    "ng_web_test_suite",
    "sass_binary",
    "sass_library",
    "ts_project",
)

package(default_visibility = ["//visibility:public"])

sass_library(
    name = "m3",
    srcs = [
        "_m3-tabs.scss",
    ],
    deps = [
        "//src/material/core/style:sass_utils",
        "//src/material/core/theming:_inspection",
        "//src/material/core/tokens:m3_utils",
    ],
)

sass_library(
    name = "m2",
    srcs = [
        "_m2-tabs.scss",
    ],
    deps = [
        "//src/material/core/style:elevation",
        "//src/material/core/style:sass_utils",
        "//src/material/core/theming:_inspection",
        "//src/material/core/tokens:m2_utils",
    ],
)

sass_library(
    name = "theme",
    srcs = [
        "_tabs-theme.scss",
    ],
    deps = [
        ":m2",
        "//src/material/core/style:sass_utils",
        "//src/material/core/theming",
        "//src/material/core/theming:_inspection",
        "//src/material/core/theming:_validation",
        "//src/material/core/tokens:token_utils",
        "//src/material/core/typography",
    ],
)

sass_library(
    name = "sass",
    srcs = [
        "_tabs-common.scss",
    ],
    deps = [
        "//src/material/core/style:vendor_prefixes",
        "//src/material/core/tokens:token_utils",
    ],
)

sass_binary(
    name = "tab_group_css",
    src = "tab-group.scss",
    deps = [
        ":m2",
        ":sass",
        "//src/material/core/style:private",
        "//src/material/core/style:variables",
    ],
)

sass_binary(
    name = "tab_nav_bar_css",
    src = "tab-nav-bar/tab-nav-bar.scss",
    deps = [
        ":sass",
    ],
)

sass_binary(
    name = "tab_link_css",
    src = "tab-nav-bar/tab-link.scss",
    deps = [
        ":sass",
        "//src/material/core/style:variables",
    ],
)

sass_binary(
    name = "tab_header_css",
    src = "tab-header.scss",
    deps = [
        ":sass",
        "//src/cdk:sass_lib",
    ],
)

sass_binary(
    name = "tab_body_css",
    src = "tab-body.scss",
    deps = ["//src/material/core/style:layout_common"],
)

ng_project(
    name = "tabs",
    srcs = [
        "index.ts",
        "ink-bar.ts",
        "module.ts",
        "paginated-tab-header.ts",
        "public-api.ts",
        "tab.ts",
        "tab-body.ts",
        "tab-config.ts",
        "tab-content.ts",
        "tab-group.ts",
        "tab-header.ts",
        "tab-label.ts",
        "tab-label-wrapper.ts",
        "tab-nav-bar/tab-nav-bar.ts",
        "tabs-animations.ts",
    ],
    assets = [
        "tab-body.html",
        "tab-group.html",
        "tab-header.html",
        "tab.html",
        "tab-nav-bar/tab-nav-bar.html",
        "tab-nav-bar/tab-link.html",
        ":tab_group_css",
        ":tab-nav-bar/tab-nav-bar.css",
        ":tab-nav-bar/tab-link.css",
        ":tab_header_css",
        ":tab_body_css",
    ],
    deps = [
        "//:node_modules/@angular/common",
        "//:node_modules/@angular/core",
        "//:node_modules/rxjs",
        "//src:dev_mode_types",
        "//src/cdk/a11y",
        "//src/cdk/bidi",
        "//src/cdk/coercion",
        "//src/cdk/keycodes",
        "//src/cdk/observers",
        "//src/cdk/observers/private",
        "//src/cdk/platform",
        "//src/cdk/portal",
        "//src/cdk/scrolling",
        "//src/material/core",
    ],
)

ts_project(
    name = "tabs_tests_lib",
    testonly = True,
    srcs = glob(
        ["**/*.spec.ts"],
    ),
    deps = [
        ":tabs",
        "//:node_modules/@angular/common",
        "//:node_modules/@angular/core",
        "//:node_modules/@angular/platform-browser",
        "//:node_modules/rxjs",
        "//src/cdk/bidi",
        "//src/cdk/keycodes",
        "//src/cdk/observers",
        "//src/cdk/observers/private",
        "//src/cdk/portal",
        "//src/cdk/scrolling",
        "//src/cdk/testing/private",
        "//src/cdk/testing/testbed",
        "//src/material/core",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    deps = [
        ":tabs_tests_lib",
    ],
)

markdown_to_html(
    name = "overview",
    srcs = [":tabs.md"],
)

extract_tokens(
    name = "tokens",
    srcs = [":theme"],
)

filegroup(
    name = "source-files",
    srcs = glob(["**/*.ts"]),
)
